cd "F:\Dropbox\School\Research Projects\Populism\Articles\Populist Psychology\Submission files\JOP 2020\Final\Replication files"

use "study 3 prepped.dta", clear


*generates two-point treatment that only tests the effect of cult and econ threat, rather than specific emotions
*Redoes the label so that everything looks good on the graph
label define regionlab1 1 "Southeast" 2 "Northeast" 3 "Midwest" 4 "West" 5 "Southwest" 6 "Non-continental US"
label values region regionlab1
label define treatlab1 0 "Control" 1 "Cultural Threat" 2 "Economic Threat, Fear" 3 "Economic Threat, Anger"
label values treat treatlab1 


*w emotions
lab var pp "Punitivism"
lab var dec "Declinism"
lab var lwprod "Producerism"
lab var rwprod "Auth. Producerism"
lab var socvic "Social Victimization"
lab var auth "Authoritarianism"
lab var rs "Regime Support"
lab var soct "Sociotropic Evaluation"
lab var anger "Anger"
lab var fear "Fear"
lab var gender "Gender"
lab var region "Region"
lab var partyid "Party Identification"
lab var ed "Education"
lab var income "Income"
lab var race "Race"
lab var latino "Latino"
lab var age "Age"
label define gender 1 "Male" 2 "Female"
label values gender gender
label define race 1 "White" 2 "Black" 3 "Other"
label values race race
label define latino 1 "Not Latino" 2 "Latino"
label values latino latino
lab var ppl "Popularism"
lab var ant "Antielitism"
lab var man "Manichaeism"
lab var cultanx "Cultural Discontent"

foreach var of varlist ed income age partyid anger fear soct lwprod rwprod dec man pp rs auth ppl ant socvic rbe perf consp cultanx  {
qui sum `var'
replace `var' = (`var' - `r(min)') / (`r(max)'-`r(min)')
}

*runs the regressions to get estimates for graphs

reg ppl i.treat
estimates store a
reg ant i.treat
estimates store b
reg man i.treat
estimates store c
reg cultanx i.treat
estimates store d
reg fear i.treat
estimates store e
reg anger i.treat
estimates store f

*makes graph

coefplot a, bylabel(Popularism) drop(_cons) xline(0) || /*
*/b, bylabel(Antielitism) drop(_cons) xline(0) || /*
*/c, bylabel(Manichaeism) drop(_cons) xline(0) || /*
*/d, bylabel("Cultural" "Discontent") drop(_cons) xline(0) || /*
*/e, bylabel(Fear) drop(_cons) xline(0) || /*
*/f, bylabel(Anger) drop(_cons) xline(0) || /*
*/,byopts(row(1))  bycoefs msize(vsmall) graphregion(color(white))
